import Vue from 'vue'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'

// 导入hello组件
import hello from './../components/hello.vue'

// 导入导航组件
import mynav from './../components/my-nav.vue'

// 导入login组件
import login from './../components/login.vue'

import App from './../App.vue'

// 导入directives组件
import directives from './../components/directives.vue'
// 导入directives组件
import lifecycle from './../components/lifecycle.vue'

Vue.config.productionTip = false
// 开启debug模式
Vue.config.debug = true

Vue.use(VueRouter)
Vue.use(VueResource)

// 定义路由
const router = new VueRouter({
    // mode: 'history',
    // base: __dirname,
    routes: [
        {
            path: '/directives',
            component: directives
        },
        {
            path: '/lifecycle',
            component: lifecycle
        }
    ]
})

console.log(router)

// const app = new Vue({
//     el: "#app",
//     components: { lifecycle,directives },
//     router: router,
//     methods: {
//         test: () => {
//             console.log(this);
//         }
//     }
// })

const app = new Vue({
    router
  }).$mount('#app')
